package com.ysd.dao;

import java.util.Date;

import javax.transaction.Transactional;

import org.springframework.data.jpa.repository.JpaRepository;


import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import com.ysd.entity.User;

public interface userDao extends JpaRepository<User, Integer>,JpaSpecificationExecutor<User> {
	//登录时判断用户是否用到
	@Query(value = "SELECT * FROM user WHERE uloginname=?1 and upassword =?2",nativeQuery = true)
	User findByadmin(String login_name,String password);
	
	//重置密码
	@Transactional
	@Modifying
	@Query(value = "update user set upassword= ?1 where uid=?2 ", nativeQuery = true)
	Integer ResetPwdById(Integer pwd,Integer id);
	//是否锁定
	@Transactional
	@Modifying
	@Query(value = "update user set uislockout=?1 where uid=?2 ", nativeQuery = true)
	Integer updateLockById(String string, Integer id);
	
}
